package utils;

public class VerifyEmail {
    public static boolean send(String email, String type, String vcode){
        EmailSender sender = new EmailSender("smtp.126.com", "465", "hcdstudio@126.com", "alsldlhcd");
        String subject = "欢迎使用点滴";
        String body = "欢迎使用点滴";
        switch (type){
            case "reg":
                subject = "欢迎您注册点滴，请验证邮箱";
                String regurl = "http://120.77.44.149/emailVerify.do?type=reg&email="+email+"&code="+vcode;
                body = "您好，"+email+"<br>"+
                        "欢迎您注册点滴，请使用下面的链接完成邮箱的验证<br>" +
                        "<a href='"+regurl+"'>"+regurl+"</a> <br>" +
                        "如果链接无法点击，请复制到浏览器中访问。请尽快在1小时内完成验证。若非本人操作，请忽略本邮件，无论如何，请勿将该邮件泄漏给他人。请勿回复此邮件。<br>";
                break;
            case "forget":
                subject = "点滴账号忘记密码重置";
                String forgetUrl = "http://120.77.44.149/email_return.html?email="+email+"&code="+vcode;
                body = "您好，"+email+"<br>"+
                        "请使用下面的链接完成密码重置<br>" +
                        "<a href='"+forgetUrl+"'>"+forgetUrl+"</a> <br>" +
                        "如果链接无法点击，请复制到浏览器中访问。请尽快在1小时内完成操作。若非本人操作，请忽略本邮件，无论如何，请勿将该邮件泄漏给他人。请勿回复此邮件。<br>";
                break;
        }

        return sender.sendingMimeMail("hcdstudio@126.com", email, "", "", subject, body);

    }
}
